package com.myteam.mystory.adapter;

import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.content.res.TypedArray;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

import com.myteam.mystory.R;

public class BookmarkAdapter extends ArrayAdapter<String> {
	private Context context;
	private String[] bookmark_namestory;
	
	TextView tv_namestory;
	
	final int INVALID_ID = -1;
    HashMap<String, Integer> mIdMap = new HashMap<String, Integer>();
	
	public BookmarkAdapter(Context context, int resource, List<String> objects) {
		super(context, resource, objects);
		this.context = context;
		bookmark_namestory = new String[]{"adfasgf","agđgadf","agfdsagag","agfhagfd","agfag","agfah","agfahg","agah","aghadhf","agfah"};
//		for (int i = 0; i < objects.size(); ++i) {
//			mIdMap.put(objects.get(i), i);
//		}
	}
	
//	@Override
//    public long getItemId(int position) {
//        if (position < 0 || position >= mIdMap.size()) {
//            return INVALID_ID;
//        }
//        String item = getItem(position);
//        return mIdMap.get(item);
//    }
//	
//
//	@Override
//	public boolean hasStableIds() {
//		return true;
//	}
	
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		View rowView = inflater.inflate(R.layout.bookmark_adapter, parent,false);
		tv_namestory = (TextView) rowView.findViewById(R.id.bookmark_nameStory);
		tv_namestory.setText(bookmark_namestory[position]);
		TypedArray a = context.obtainStyledAttributes(R.styleable.Gallery1);
		int mGalleryItemBackground = a.getResourceId(R.styleable.Gallery1_android_galleryItemBackground, 0);
		a.recycle();
		rowView.setBackgroundResource(mGalleryItemBackground);
		return rowView;
	}
}
